package com.example.lianjiaproject.controller;

import com.example.lianjiaproject.dao.SpiderDao;
import com.example.lianjiaproject.pojo.Name_value;
import com.example.lianjiaproject.pojo.Price;
import com.example.lianjiaproject.pojo.Subway_type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/SpiderProject/Info")
public class RegionInfoController {
    @Autowired
    private SpiderDao spiderDao;

    @PostMapping("/apartment_complex_Count")
    public List apartment_complex_Count(@RequestBody Price price){
        List<Subway_type> depts = spiderDao.apartment_complex_Count(price.getMin(),price.getMax(),price.getRent(),price.getRegion(),price.getFloor(),price.getLift());
        return depts;
    }

    @PostMapping("/apartment_layout_price")
    public List apartment_layout_price(@RequestBody Price price){
        List<Subway_type> depts = spiderDao.apartment_layout_price(price.getMin(),price.getMax(),price.getRent(),price.getRegion(),price.getFloor(),price.getLift());
        return depts;
    }

    @PostMapping("/Rent_count")
    public List Rent_count(@RequestBody Price price){
        List<Name_value> depts = spiderDao.Rent_count(price.getMin(),price.getMax(),price.getRent(),price.getRegion(),price.getFloor(),price.getLift());
        return depts;
    }

    @PostMapping("/Area_Price_AVG")
    public List Area_Price_AVG(@RequestBody Price price){
        List<Name_value> depts = spiderDao.Area_Price_AVG(price.getMin(),price.getMax(),price.getRent(),price.getRegion(),price.getFloor(),price.getLift());
        return depts;
    }

    @PostMapping("/orientation_price")
    public List orientation_price(@RequestBody Price price){
        List<Subway_type> depts = spiderDao.orientation_price(price.getMin(),price.getMax(),price.getRent(),price.getRegion(),price.getFloor(),price.getLift());
        return depts;
    }

}
